﻿// FluentViewModel (http://fluentviewmodel.codeplex.com/)
//
// Copyright © 2010 Kialco Group 
//
// The contents of this file are subject to the Mozilla Public
// License Version 1.1 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of
// the License at http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an 
// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
// implied. See the License for the specific language governing
// rights and limitations under the License.

using System;

namespace FluentViewModel
{
    /// <summary>
    /// Service locator behavior.
    /// </summary>
    public interface IServiceLocator
    {
        /// <summary>
        /// Registers the service with the container.
        /// </summary>
        /// <param name="configuration">The service configuration.</param>
        void RegisterService(IServiceConfiguration configuration);

        /// <summary>
        /// Registers the view model with the container.
        /// </summary>
        /// <param name="configuration">The view model configuration.</param>
        void RegisterViewModel(IViewModelConfiguration configuration);

        /// <summary>
        /// Resolves a service or view model of the specified type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>An instance of the service or view model.</returns>
        object Resolve(Type type);

        /// <summary>
        /// Resolves a service or view model of the specified type.
        /// </summary>
        /// <typeparam name="TService">The type of the service.</typeparam>
        /// <returns>An instance of the service or view model.</returns>
        TService Resolve<TService>();
    }
}